package com.telenav.tengfen;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class ActivitesAdapter extends BaseAdapter {

	private Context mContext;
	private Integer[] mImageIds;
	private ImageView[] mImages;

	public ActivitesAdapter(Context c, Integer[] ImageIds) {
		mContext = c;
		mImageIds = ImageIds;
		mImages = new ImageView[mImageIds.length];
	}

	public boolean createReflectedImages() {
		int index = 0;
		for (int imageId : mImageIds) {
			Bitmap originalImage = BitmapFactory.decodeResource(
					mContext.getResources(), imageId);
			ImageView imageView = new ImageView(mContext);
			imageView.setImageBitmap(originalImage);
			imageView.setLayoutParams(new Gallery.LayoutParams(420, 400));
			mImages[index++] = imageView;
		}
		return true;
	}

	public int getCount() {
		return mImageIds.length;
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		return mImages[position];
	}
}
